package fr.uniscol.siecle.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

public class Eleve implements Serializable, DonneeSiecle {

	private AnneeScolaire annee = null;
	
	private int id = 0;
	
	private int noet = 0;
	
	private String idEleveEtablissement = null;
	
	private String nom = null;
	
	private String prenom = null;
	
	private String prenom2 = null;
	
	private String ine = null;
	
	private Date dateNaissance = null;
	
	private boolean redoublant = false;
	
	private boolean accepteSMS = false;
	
	private Date dateSortie = null;
	
	private Date dateEntree = null;
	
	private String villeNaissance = null;
	
	private String sexe = null;
	
	private RegimeEleve regime = null;
	
	private MotifSortie motifSortie = null;
	
	private Provenance provenance = null;
	
	private Bourse bourse = null;
	
	private OptionEleve options = null;
	
	private List<Division> structures = null;
	
	private MEF mef = null;

	public Eleve() {
		super();
	}
	
	public Eleve(int id, int noet, String idEleveEtablissement, String nom, String prenom) {
		super();
		this.id = id;
		this.noet = noet;
		this.idEleveEtablissement = idEleveEtablissement;
		this.nom = nom;
		this.prenom = prenom;
	}

	public Eleve(AnneeScolaire annee, int id, int noet, String idEleveEtablissement, String nom, String prenom) {
		super();
		this.annee = annee;
		this.id = id;
		this.noet = noet;
		this.idEleveEtablissement = idEleveEtablissement;
		this.nom = nom;
		this.prenom = prenom;
	}

	public AnneeScolaire getAnnee() {
		return annee;
	}

	public void setAnnee(AnneeScolaire annee) {
		this.annee = annee;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public int getNoet() {
		return noet;
	}

	public void setNoet(int noet) {
		this.noet = noet;
	}

	public String getIdEleveEtablissement() {
		if(idEleveEtablissement == null){
			idEleveEtablissement = "";
		}
		return idEleveEtablissement;
	}

	public void setIdEleveEtablissement(String idEleveEtablissement) {
		this.idEleveEtablissement = idEleveEtablissement;
	}

	public String getNom() {
		if(nom == null){
			nom = "";
		}
		return nom;
	}

	public void setNom(String nom) {
		this.nom = nom;
	}

	public String getPrenom() {
		if(prenom == null){
			prenom = "";
		}
		return prenom;
	}

	public void setPrenom(String prenom) {
		this.prenom = prenom;
	}

	public String getPrenom2() {
		if(prenom2 == null){
			prenom2 = "";
		}
		return prenom2;
	}

	public void setPrenom2(String prenom2) {
		this.prenom2 = prenom2;
	}

	public String getIne() {
		if(ine == null){
			ine = "";
		}
		return ine;
	}

	public void setIne(String ine) {
		this.ine = ine;
	}

	public Date getDateNaissance() {
		return dateNaissance;
	}

	public void setDateNaissance(Date dateNaissance) {
		this.dateNaissance = dateNaissance;
	}

	public boolean isRedoublant() {
		return redoublant;
	}

	public void setRedoublant(boolean redoublant) {
		this.redoublant = redoublant;
	}

	public boolean isAccepteSMS() {
		return accepteSMS;
	}

	public void setAccepteSMS(boolean accepteSMS) {
		this.accepteSMS = accepteSMS;
	}

	public Date getDateSortie() {
		return dateSortie;
	}

	public void setDateSortie(Date dateSortie) {
		this.dateSortie = dateSortie;
	}

	public Date getDateEntree() {
		return dateEntree;
	}

	public void setDateEntree(Date dateEntree) {
		this.dateEntree = dateEntree;
	}

	public String getVilleNaissance() {
		return villeNaissance;
	}

	public void setVilleNaissance(String villeNaissance) {
		this.villeNaissance = villeNaissance;
	}

	public String getSexe() {
		return sexe;
	}

	public void setSexe(String sexe) {
		this.sexe = sexe;
	}

	public RegimeEleve getRegime() {
		return regime;
	}

	public void setRegime(RegimeEleve regime) {
		this.regime = regime;
	}

	public MotifSortie getMotifSortie() {
		return motifSortie;
	}

	public void setMotifSortie(MotifSortie motifSortie) {
		this.motifSortie = motifSortie;
	}

	public Provenance getProvenance() {
		return provenance;
	}

	public void setProvenance(Provenance provenance) {
		this.provenance = provenance;
	}

	public Bourse getBourse() {
		return bourse;
	}

	public void setBourse(Bourse bourse) {
		this.bourse = bourse;
	}

	public OptionEleve getOptions() {
		return options;
	}

	public void setOptions(OptionEleve options) {
		this.options = options;
	}

	public List<Division> getStructures() {
		if(structures == null){
			structures = new ArrayList<Division>();
		}
		return structures;
	}

	public void setStructures(List<Division> structures) {
		this.structures = structures;
	}

	public MEF getMef() {
		return mef;
	}

	public void setMef(MEF mef) {
		this.mef = mef;
	}

	@Override
	public boolean equals(Object obj) {
		Eleve e = (Eleve)obj;
		return getId() == e.getId()
		&& getAnnee().equals(e.getAnnee());
	}

	@Override
	public int hashCode() {
		return getId() + getAnnee().hashCode();
	}
}
